#include <iostream>
#include <cstdio>
using namespace std;

int main(){
	int n,j=0,y=0,t=0;
	int a,b,c;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a>>b>>c;
		j+=a;
		y+=b;
		t+=c;
	} 
	printf("%d %d %d %d",j,y,t,j+y+t);
	return 0;
}
